package com.his.struts.filter;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

import org.apache.log4j.Logger;

import com.his.struts.dao.comment.CommentImp;
/**
 * 转码过滤器
 * @author xiaoweiliang
 *
 */
public class CodeFilter implements Filter{
	Logger log = Logger.getLogger(CodeFilter.class);
	public void destroy() {
		log.info("编码---过滤器已关闭");
	}

	public void doFilter(ServletRequest request, ServletResponse response,
			FilterChain chain) throws IOException, ServletException {
		request.setCharacterEncoding("UTF-8");
		response.setCharacterEncoding("UTF-8");
		chain.doFilter(request, response);
	}

	public void init(FilterConfig arg0) throws ServletException {
		log.info("编码---过滤器已启动");
	}

	
	
}
